package com.xuhai.util

import java.util.Date

import org.apache.commons.lang.time.DateUtils
import org.apache.commons.lang3.time.FastDateFormat


/**
  * Created by chuxw on 2018/3/29.
  */
object DateUtil{
  val fdf = FastDateFormat.getInstance("yyyyMMdd")

  def getEnterRateDateRange(date: Date):String = {
    val sdf = FastDateFormat.getInstance("yyyyMMddHHmmss")
    val dayStr = fdf.format(date) + "223000"
    val base = sdf.parse(dayStr)
    val builder = new StringBuilder
    builder.append(sdf.format(base)).append(",")
    for (a <- 1 to 30){
      builder.append("\'" + sdf.format(DateUtils.addMinutes(base, a)) + "\'").append(",")
    }
    builder.toString().substring(0, builder.toString().length-1)
  }

}
